gh-88178: IPv6Address.exploded with scope_id - #25824
Merged
serhiy-storchaka merged 4 commits intoAug 13, 2026
Merged
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
Support for scoped IPv6 addresses was implemented in bpo-34788
but missed implementing the .exploded method:
>>> import ipaddress
>>> ipaddress.IPv6Address('fe80::1%eth0').exploded
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/ipaddress.py", line 394, in exploded
return self._explode_shorthand_ip_string()
File "/usr/lib/python3.9/ipaddress.py", line 1824, in _explode_shorthand_ip_string
ip_int = self._ip_int_from_string(ip_str)
File "/usr/lib/python3.9/ipaddress.py", line 1705, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Only hex digits permitted in '1%eth0' in 'fe80::1%eth0'
After this commit:
>>> import ipaddress
>>> ipaddress.IPv6Address('fe80::1%eth0').exploded
'fe80:0000:0000:0000:0000:0000:0000:0001%eth0'
ohwgiles
force-pushed
the
ipv6address-exploded-with-scope_id
branch
from
June 3, 2021 22:26
3852867 to
3902135
Compare
|
This PR is stale because it has been open for 30 days with no activity. |
IPv6Interface.exploded silently omitted the scope ID, unlike str() and compressed. Attach it in one place, before the prefix length, so that all three representations agree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
serhiy-storchaka
approved these changes
Aug 12, 2026
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
Fixed support of interfaces. LGTM now.
IPv6Interface.exploded is not documented separately, so reference the classes instead of the attribute. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Thanks @ohwgiles for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-155655 is a backport of this pull request to the 3.15 branch. |
|
GH-155656 is a backport of this pull request to the 3.14 branch. |
|
GH-155657 is a backport of this pull request to the 3.13 branch. |
serhiy-storchaka
added a commit
that referenced
this pull request
Aug 13, 2026
… (GH-155657) IPv6Address.exploded raised AddressValueError, and IPv6Interface.exploded omitted the scope ID. (cherry picked from commit a2104b7) Co-authored-by: Oliver Giles <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
serhiy-storchaka
added a commit
that referenced
this pull request
Aug 13, 2026
… (GH-155656) IPv6Address.exploded raised AddressValueError, and IPv6Interface.exploded omitted the scope ID. (cherry picked from commit a2104b7) Co-authored-by: Oliver Giles <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mbeijen
pushed a commit
to mbeijen/cpython
that referenced
this pull request
Aug 14, 2026
…-25824) IPv6Address.exploded raised AddressValueError, and IPv6Interface.exploded omitted the scope ID. Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support for scoped IPv6 addresses was implemented in bpo-34788 but missed implementing the .exploded method:
After this commit:
https://bugs.python.org/issue44012